package com.shigu.mo.bo.requests;

import com.shigu.mo.exceptions.MoException;
import org.hibernate.validator.constraints.NotEmpty;

import javax.validation.constraints.NotNull;

/**
 * 代理修改商户的费率
 */
public class AgentModifyRateRequest extends MoRequest{
    @NotNull(message = "请先选择商户")
    private Long busId;
    @NotEmpty(message = "请输入费率")
    private String rate;
    @NotNull(message = "请选择通道")
    private Long pid;//通道ID

    public Long getBusId() {
        return busId;
    }

    public void setBusId(Long busId) {
        this.busId = busId;
    }

    public String getRate() {
        return rate;
    }

    public void setRate(String rate) {
        this.rate = rate;
    }

    public Double getRateDouble() throws MoException {
        rate=rate.replace("%","");
        try {
            return Double.valueOf(rate);
        } catch (NumberFormatException e) {
            throw new MoException("用户费率的格式不正确");
        }
    }

    public Long getPid() {
        return pid;
    }

    public void setPid(Long pid) {
        this.pid = pid;
    }
}
